package cn.calin.day05.demo29Calendar;

import java.time.Year;
import java.util.Calendar;

public class Test02 {
    public static void main(String[] args) {
        //获取日历类对象
        Calendar calendar=Calendar.getInstance();

        //get方法
        int year= calendar.get(Calendar.YEAR);
        System.out.println(year);

        int month=calendar.get(Calendar.MONTH)+1;
        System.out.println(month);

        //设置set方法
        calendar.set(Calendar.YEAR,2088);
        year= calendar.get(Calendar.YEAR);
        System.out.println(year);

        //add方法
        calendar.add(Calendar.YEAR,2);
        year= calendar.get(Calendar.YEAR);
        System.out.println(year);
    }
}
